require 'uranium/page'

module Google
	class SearchPage < Page
		@@url[self] = "http://www.google.com"
		@@opts[self] = {
		  'wait_for_page_to_load' => true,
		}
		@@elements[self]	= {
			'query'						=> "gbqfq",
			'search_button'		=> "gbqfba",
		}
		
		#
		# Put useful methods here
		#
		
		def verify_result(item, domain)
			url = get_attribute("//div[@id='res']//li[@class='g'][#{item}]//a[1]", "href")
			got_domain = url.match(/http:\/\/(.*?)\//)[1]
			assert_equal(domain, got_domain)
		end
	end
end
